package com.elitesland.system.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import com.elitesland.system.convert.BooleanToIntegerConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * <p>
 * 分类码明细表
 * </p>
 *
 * @author Mir
 * @date 2020/5/15
 */
@Entity
@Table(name = "sys_udc")
@org.hibernate.annotations.Table(appliesTo = "sys_udc", comment = "分类码表")
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "记录分类码的系统表", description = "分类码表")
public class SysUdcDO extends BaseModel implements Serializable {

    private static final long serialVersionUID = -6618541083363538072L;

    @ApiModelProperty(value = "领域码")
    @Comment("领域码")
    @Column(length = 32, nullable = false)
    String domainCode;

    @ApiModelProperty(value = "UDC码")
    @Comment("UDC码")
    @Column(length = 32, nullable = false)
    String udcCode;

    @ApiModelProperty(value = "UDC码名称")
    @Comment("UDC码名称")
    @Column(length = 64)
    String udcName;

    @ApiModelProperty(value = "UDC值")
    @Comment("UDC值")
    @Column(length = 32, nullable = false)
    String udcVal;

    @ApiModelProperty(value = "值描述")
    @Comment("值描述")
    @Column(length = 64)
    String valDesc;

    @ApiModelProperty(value = "排序号")
    @Comment("排序号")
    @Column()
    Integer valSortNo;

    @ApiModelProperty(value = "硬编码")
    @Comment("硬编码")
    @Column()
    @Convert(converter = BooleanToIntegerConverter.class)
    Boolean hdFlag;

    @ApiModelProperty(value = "是否开启数据权限")
    @Comment("是否开启数据权限")
    @Column()
    @Convert(converter = BooleanToIntegerConverter.class)
    Boolean dpFlag;

    @ApiModelProperty(value = "扩展字段1-特殊处理")
    @Comment("扩展字段1-特殊处理")
    @Column(length =32 )
    String es1;

    @ApiModelProperty(value = "扩展字段2")
    @Comment("扩展字段2")
    @Column(length = 32)
    String es2;

    @ApiModelProperty(value = "扩展字段3")
    @Comment("扩展字段3")
    @Column(length =32)
    String es3;

    @ApiModelProperty(value = "扩展字段4")
    @Comment("扩展字段4")
    @Column(length =32)
    String es4;

    @ApiModelProperty(value = "扩展字段5")
    @Comment("扩展字段5")
    @Column(length =32)
    String es5;

    @ApiModelProperty(value = "扩展字段6")
    @Comment("扩展字段6")
    @Column(length =32)
    String es6;

    @ApiModelProperty(value = "扩展字段7")
    @Comment("扩展字段7")
    @Column(length =32)
    String es7;

    @ApiModelProperty(value = "扩展字段8")
    @Comment("扩展字段8")
    @Column(length =32)
    String es8;

    @ApiModelProperty(value = "扩展浮点1")
    @Comment("扩展浮点1")
    @Column()
    Double ef1;

    @ApiModelProperty(value = "扩展浮点2")
    @Comment("扩展浮点2")
    @Column()
    Double ef2;

    @ApiModelProperty(value = "扩展浮点3")
    @Comment("扩展浮点3")
    @Column()
    Double ef3;

    @ApiModelProperty(value = "扩展浮点4")
    @Comment("扩展浮点4")
    @Column()
    Double ef4;

    @ApiModelProperty(value = "扩展整数1")
    @Comment("扩展整数1")
    @Column()
    Integer ei1;

    @ApiModelProperty(value = "扩展整数2")
    @Comment("扩展整数2")
    @Column()
    Integer ei2;

    @ApiModelProperty(value = "扩展整数3")
    @Comment("扩展整数3")
    @Column()
    Integer ei3;

    @ApiModelProperty(value = "扩展整数4")
    @Comment("扩展整数4")
    @Column()
    Integer ei4;

    @ApiModelProperty(value = "扩展日期1")
    @Comment("扩展日期1")
    @Column()
    LocalDateTime ed1;

    @ApiModelProperty(value = "扩展日期2")
    @Comment("扩展日期2")
    @Column()
    LocalDateTime ed2;

    @ApiModelProperty(value = "扩展日期3")
    @Comment("扩展日期3")
    @Column()
    LocalDateTime ed3;

    @ApiModelProperty(value = "扩展日期4")
    @Comment("扩展日期4")
    @Column()
    LocalDateTime ed4;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof SysUdcDO)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        SysUdcDO entity = (SysUdcDO) o;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}
